#ifndef SCOPEDMUTEX_H
#define SCOPEDMUTEX_H

#include "bcti_Mutex.h"
#include "easyLog.h"
namespace lzpLib{
/** 
 * Scoped Mutex wrapper. Uses "Resource Acquisition is 
 * Initialization" idiom to implement the Scoped Locking.
 */
class ScopedMutex{
public:
    ScopedMutex(Mutex &mutex):mutex_(mutex){
        mutex_.lock();
    }
    ~ScopedMutex(){
        mutex_.unlock();
    }
private:
    ScopedMutex(ScopedMutex const&);
    ScopedMutex const& operator=(ScopedMutex const&);
    Mutex &mutex_;
};
}

#endif // SCOPEDMUTEX_H
